home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / netinclude / sys / syslog.h < prev    next >
C/C++ Source or Header  |  1994-03-17  |  7KB  |  212 lines

  1. /*
  2.  * $Id: syslog.h,v 1.18 1994/03/17 04:21:50 jraja Exp $
  3.  *
  4.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  5.  *                    Helsinki University of Technology, Finland.
  6.  *                    All rights reserved.
  7.  *
  8.  * HISTORY
  9.  * $Log: syslog.h,v $
  10.  * Revision 1.18  1994/03/17  04:21:50  jraja
  11.  * Added INACTIVE switch to the log window parameters.
  12.  * (Suggested by Carsten Heyl.)
  13.  *
  14.  * Revision 1.17  1994/01/24  07:41:10  jraja
  15.  * Added prototypes for the openlog(), closelog() and setlogmask().
  16.  *
  17.  * Revision 1.16  1994/01/06  22:11:25  jraja
  18.  * Removed the unnecessary #ifndef AMITCP lines.
  19.  *
  20.  * Revision 1.15  1994/01/06  22:05:08  jraja
  21.  * Added inclusion of bsdsocket.h if necessary, cleaned the log.
  22.  *
  23.  * Revision 1.10  93/04/27  18:17:47  18:17:47  puhuri (Markus Peuhkuri)
  24.  * Changed default names of console and log.
  25.  * 
  26.  */
  27.  
  28. /*
  29.  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  30.  * All rights reserved.
  31.  *
  32.  * Redistribution and use in source and binary forms, with or without
  33.  * modification, are permitted provided that the following conditions
  34.  * are met:
  35.  * 1. Redistributions of source code must retain the above copyright
  36.  *    notice, this list of conditions and the following disclaimer.
  37.  * 2. Redistributions in binary form must reproduce the above copyright
  38.  *    notice, this list of conditions and the following disclaimer in the
  39.  *    documentation and/or other materials provided with the distribution.
  40.  * 3. All advertising materials mentioning features or use of this software
  41.  *    must display the following acknowledgement:
  42.  *    This product includes software developed by the University of
  43.  *    California, Berkeley and its contributors.
  44.  * 4. Neither the name of the University nor the names of its contributors
  45.  *    may be used to endorse or promote products derived from this software
  46.  *    without specific prior written permission.
  47.  *
  48.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  49.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  50.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  51.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  52.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  53.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  54.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  55.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  56.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  57.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  58.  * SUCH DAMAGE.
  59.  *
  60.  *    @(#)syslog.h    7.20 (Berkeley) 2/23/91
  61.  */
  62.  
  63. #ifndef SYS_SYSLOG_H
  64. #define SYS_SYSLOG_H
  65.  
  66. #define    _PATH_LOG    "t:AmiTCP.log"
  67. #define _PATH_CON       "con:0/0/600/100/AmiTCPIP Log/AUTO/INACTIVE"
  68.  
  69.  
  70. /*
  71.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  72.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  73.  * (0-big number).  Both the priorities and the facilities map roughly
  74.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  75.  * included in this file.
  76.  *
  77.  * priorities (these are ordered)
  78.  */
  79. #define    LOG_EMERG    0    /* system is unusable */
  80. #define    LOG_ALERT    1    /* action must be taken immediately */
  81. #define    LOG_CRIT    2    /* critical conditions */
  82. #define    LOG_ERR        3    /* error conditions */
  83. #define    LOG_WARNING    4    /* warning conditions */
  84. #define    LOG_NOTICE    5    /* normal but significant condition */
  85. #define    LOG_INFO    6    /* informational */
  86. #define    LOG_DEBUG    7    /* debug-level messages */
  87.  
  88. #define    LOG_PRIMASK    0x07    /* mask to extract priority part (internal) */
  89.                 /* extract priority */
  90. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  91. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  92.  
  93. #ifdef SYSLOG_NAMES
  94. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  95.                 /* mark "facility" */
  96. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  97. typedef struct _code {
  98.     char    *c_name;
  99.     int    c_val;
  100. } CODE;
  101.  
  102. CODE prioritynames[] = {
  103.     "alert",    LOG_ALERT,
  104.     "crit",        LOG_CRIT,
  105.     "debug",    LOG_DEBUG,
  106.     "emerg",    LOG_EMERG,
  107.     "err",        LOG_ERR,
  108.     "error",    LOG_ERR,        /* DEPRECATED */
  109.     "info",        LOG_INFO,
  110.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  111.     "notice",    LOG_NOTICE,
  112.     "panic",     LOG_EMERG,        /* DEPRECATED */
  113.     "warn",        LOG_WARNING,        /* DEPRECATED */
  114.     "warning",    LOG_WARNING,
  115.     NULL,        -1,
  116. };
  117. #endif
  118.  
  119. /* facility codes */
  120. #define    LOG_KERN    (0<<3)    /* kernel messages */
  121. #define    LOG_USER    (1<<3)    /* random user-level messages */
  122. #define    LOG_MAIL    (2<<3)    /* mail system */
  123. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  124. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  125. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  126. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  127. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  128. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  129. #define    LOG_CRON    (9<<3)    /* clock daemon */
  130. #define    LOG_AUTHPRIV    (10<<3)    /* security/authorization messages (private) */
  131.  
  132.     /* other codes through 15 reserved for system use */
  133. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  134. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  135. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  136. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  137. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  138. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  139. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  140. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  141.  
  142. #define    LOG_NFACILITIES    24    /* current number of facilities */
  143. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  144.                 /* facility of pri */
  145. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  146.  
  147.  
  148. #ifdef SYSLOG_NAMES
  149. CODE facilitynames[] = {
  150.     "auth",        LOG_AUTH,
  151.     "authpriv",    LOG_AUTHPRIV,
  152.     "cron",     LOG_CRON,
  153.     "daemon",    LOG_DAEMON,
  154.     "kern",        LOG_KERN,
  155.     "lpr",        LOG_LPR,
  156.     "mail",        LOG_MAIL,
  157.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  158.     "news",        LOG_NEWS,
  159.     "security",    LOG_AUTH,        /* DEPRECATED */
  160.     "syslog",    LOG_SYSLOG,
  161.     "user",        LOG_USER,
  162.     "uucp",        LOG_UUCP,
  163.     "local0",    LOG_LOCAL0,
  164.     "local1",    LOG_LOCAL1,
  165.     "local2",    LOG_LOCAL2,
  166.     "local3",    LOG_LOCAL3,
  167.     "local4",    LOG_LOCAL4,
  168.     "local5",    LOG_LOCAL5,
  169.     "local6",    LOG_LOCAL6,
  170.     "local7",    LOG_LOCAL7,
  171.     NULL,        -1,
  172. };
  173. #endif
  174.  
  175. #ifdef KERNEL
  176. #define    LOG_PRINTF    -1    /* pseudo-priority to indicate use of printf */
  177. #endif
  178.  
  179. /*
  180.  * arguments to setlogmask.
  181.  */
  182. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  183. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  184.  
  185. /*
  186.  * Option flags for openlog.
  187.  *
  188.  * LOG_ODELAY no longer does anything.
  189.  * LOG_NDELAY is the inverse of what it used to be.
  190.  */
  191. #define    LOG_PID        0x01    /* log the pid with each message */
  192. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  193. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  194. #define    LOG_NDELAY    0x08    /* don't delay open */
  195. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  196. #define    LOG_PERROR    0x20    /* log to stderr as well */
  197.  
  198. #ifndef KERNEL
  199. void openlog(const char *, int, int);
  200. void closelog(void);
  201. int setlogmask(int);
  202. /*
  203.  * Include protos/inlines/pragmas for the syslog()
  204.  * (+ all other AmiTCP functions)
  205.  */
  206. #ifndef BSDSOCKET_H
  207. #include <bsdsocket.h>
  208. #endif
  209. #endif /* !KERNEL */
  210.  
  211. #endif /* !SYS_SYSLOG_H */
  212.